<template>
	<view class="">
		<view class="comments">
			<view class="list" v-for="(item,index) in list" :key="index">
				<view class="list_info flexo">
					<image :src="item.user_info.Avatar" mode=""></image>
					<view class="list_r">
						<view class="top flex">
							<span>{{ item.user_info.MemberName }}</span>
							<span>{{ item.create_time_t }}</span>
						</view>
						<!-- 评星 -->
						<view class="star">
							<uni-rate size="14" disabled="true" :value="item.level" active-color="#df0305"></uni-rate>
						</view>
					</view>
				</view>
				<view class="contant">
					{{item.content}}
				</view>
				<view class="reply" v-if="item.child.length" v-for="(items,key) in item.child" :key="key">
					<text class="reply_one">{{runname}}： </text> <text>{{ items.content}}</text>
					<view class="reply_jt">
					</view>
				</view>
			</view>
		</view>
		<!-- loading 遮罩层 -->
		<loading v-if="loadflag"></loading>
		<navigation></navigation>
	</view>
</template>

<script>
	import uniRate from "@/components/uni-rate/uni-rate.vue"
	import loading from "@/components/loading/loading.vue"
	import navigation from '@/components/navigation/navigation.vue';
	export default {
		components: {uniRate,loading,navigation},
		data () {
			return {
				loadflag:true,
				flag:false,
				active_id:'',
				currentpage:'1',
				last_page:'',
				list:[],
				runname:''
			}
		},
		onLoad(options) {
			this.active_id = options.active_id
			this.runname = options.runname 
		},
		mounted() {
			this.getcommentList()
		},
		onReachBottom() {
			if (this.currentpage == this.last_page) {
				this.toast('没有更多评论了')
				return 
			}
			this.currentpage ++
			this.getcommentList()
		},
		methods: {
			getcommentList () {
				this.ajax('active/activeEval', {
					data:{
						active_id:this.active_id,
						page: this.currentpage,
					},
					success:res => {
						 // console.log (res)
						var comment = res.msg.data
						comment = comment.forEach( (e) => {
							e.user_info.Avatar = e.user_info.Avatar.replace("http:","https:")
							e.create_time_t= e.create_time.split(' ')[0]
							e.update_time= e.update_time.split(' ')[0]
						})
						this.list= this.list.concat(res.msg.data)
						this.last_page = res.msg.last_page
						this.loadflag = false
					}
				})
			},
		}
	}
</script>

<style>
	page {
		background-color: #FFFFFF;
	}
</style>
<style lang="less" scoped>
	@import url("../../static/less/pageA/competiondetail/discuss.less");
</style>
